<?php

$from_name = "Jansen Furniture";
$from_email = "info@jansenfurniture.com.hk";
$to_name = $webmaster_name;
$to_email = $webmaster_email;
$subject = "A new order from customer {$dealer_name}";
$article='Article #';

$content = <<<EOT
<html>
<head>
<link href="{$web_url}css/jansenfurniture.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<table width="100%" height="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top" align="center"><div><img name="" src="{$web_url}images/spacer.gif" width="568" height="10" alt=""></div>
      <table width="868" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td background="{$web_url}images/colour/jf_colour_navy_100.gif"><img name="" src="{$web_url}images/spacer.gif" width="868" height="1" alt="">
		  </td>
        </tr>
        <tr>
          <td bgcolor="FFFFFF" width="868" align="left" valign="top">
		  <table width="868" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td background="{$web_url}images/colour/jf_colour_navy_100.gif" width="1">
				<img name="" src="{$web_url}images/spacer.gif" width="1" height="1" alt="">
				</td>
                <td width="868" align="left" valign="top" background="{$web_url}images/colour/jf_colour_navy_07.gif">
				<div><img name="" src="{$web_url}images/spacer.gif" width="568" height="5" alt=""></div>
                 <table width="868" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="5"><img name="" src="{$web_url}images/spacer.gif" width="5" height="5" alt=""></td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="{$web_url}images/spacer.gif" width="10" height="10" alt=""></td>
                      <td bgcolor="FFFFFF" width="838"><img name="" src="{$web_url}images/spacer.gif" width="538" height="10" alt=""></td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="{$web_url}images/spacer.gif" width="10" height="10" alt=""></td>
                      <td width="1" align="left" valign="top" background="{$web_url}images/colour/jf_colour_navy_15.gif">
					  <img name="" src="{$web_url}images/colour/jf_colour_navy_07.gif" width="1" height="1" alt=""></td>
                      <td width="4"><img name="" src="{$web_url}images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    <tr>
                      <td width="5"><img name="" src="{$web_url}images/spacer.gif" width="5" height="5" alt=""></td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="{$web_url}images/spacer.gif" width="10" height="10" alt=""></td>
                      <td bgcolor="FFFFFF" width="838" class="text"><div><img name="" src="{$web_url}images/spacer.gif" width="538" height="10" alt=""></div>
                       <div align="center"><img src="{$web_url}images/nav/jf_nav_logo.gif" alt="jans2en furniture" name="jf_nav_logo" width="150" height="210" id="jf_nav_logo"></div>
                        <div><img name="" src="{$web_url}images/spacer.gif" width="838" height="10" alt=""></div>                        
                        <div class="paragraphSpacer"><img name="" src="{$web_url}images/spacer.gif" width="0" height="0" alt=""></div>

EOT;

$content .= <<<EOT
                        <table width="838" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                             <td colspan="9"> 
							<table width="838" border="0" cellspacing="0" cellpadding="0" align="center">        			    		
        			    		<tr><td colspan="9" align="left" class="titles">Dear {$to_name}:</td></tr>
        			    		<tr><td colspan="9" height=5></td></tr>
        			    		<tr><td colspan="9" height=5></td></tr>        			    		
        			    		<tr><td colspan="9">Attached is a new order from customer  {$dealer_name}</td></tr>
        			    		<tr><td colspan="9" height=5></td></tr>        			    		
        			    		<tr><td colspan="9">Please follow up.</td></tr>
        			    		<tr><td colspan="9" height=5></td></tr>
        			    		<tr><td colspan="9" height=5></td></tr>        			    		
        			    		<tr><td colspan="9" height=5>
								
        			    		<table width="538" border="0" cellspacing="0" cellpadding="0">
        			    		<tr>
								 <td  align="right" width="105"><strong>Tracking No.</strong> :</td>
								 <td align="left">&nbsp;$orderid</td>
								</tr>
        			    		
								<tr>
								  <td  align="right" ><strong>Customer</strong> :</td>
								  <td align="left">&nbsp;{$user_info_ary['firstname']} {$user_info_ary['lastname']}</td></tr>
			    		        <tr>
								  <td  align="right" ><strong>City</strong> :</td>
								  <td align="left">&nbsp;{$user_info_ary['city']}</td>
								 </tr>
			    		        <tr>
								  <td  align="right" ><strong>Country</strong> :</td>
								  <td align="left">&nbsp;{$COUNTRY_ARY[$user_info_ary['countryid']]}</td>
								 </tr>
			    		        </table>
								
			    		        </td>
								</tr>
			    		                			    		
        			    		<tr><td colspan="12" height=5></td></tr>
        			    		<tr><td colspan="12" height=5></td></tr>	
        			    		<tr><td colspan="12" bgcolor="#000000" height=1></td></tr>		
        						<tr class="cartAlternatingRowB"  height="30">
        						    <td align="center" valign="middle" class="cartHeading" width="60"></td>
			    			        <td align="center" valign="middle" class="cartHeading" width="80">Sections</td>   
        			    			<td align="left" valign="middle" class="cartHeading" width="100">{$article}</td><td align="right" valign="middle" class="cartHeading" width="10"></td>
									<td align="left" valign="middle" class="cartHeading"  colspan="2">Description</td> 
        			    			<td align="left" valign="middle" class="cartHeading" width="60">Finish</td>    
									<td align="right" valign="middle" class="cartHeading" width="10"></td> 
									<td align="left" valign="middle" class="cartHeading" width="110">Fabric / Leather</td> 
        			    			<td align="right" valign="middle" class="cartHeading" width="80">Price<br>{$money_type}</td>
        			    			<td align="right" valign="middle" class="cartHeading" width="80">Qty</td>
        			    			<td align="right" valign="middle" class="cartHeading" width="80">Total<br>{$money_type}</td>
        						</tr>
        						<tr><td colspan="12" bgcolor="#A5AAB0" height=1></td></tr>
EOT;

foreach ($info_ary as $k=>$v) {
    @list($type, $k,$fitemid, $fabid, $leaid) = explode("_", $k); 
    $location = $v['intype'] == 0 ? 'Products' : $location_info_ary[$v['intype']];
    if (trim($all_product_info_ary[$k]['small_pic']) == "" || !file_exists("./attachments/" . $all_product_info_ary[$k]['small_pic'])) {
        $pic_url = 'no_40.gif';
    } else {
        $pic_url = $all_product_info_ary[$k]['small_pic'];
    }
    
    $v['price']  = number_format($v['price'], 2, '.', ',');
	$v['cost']   = number_format($v['cost'], 2, '.', ',');
	$fabric_choice = ! empty($v['fabid']) ? $_fabric_item[$v['fabid']] : $_leather_item[$v['leaid']];
	
$content .= <<<EOT

        			            <tr class="cartAlternatingRowB1" height=45>
        			                <td align="center" valign="middle">
									<img src="{$web_url}attachments/{$pic_url}" border="0" class="picture" width="40" height="40"></td>
			    			        <td align="center" valign="top" class="cartmiddle">$location</td>	
        			    			<td align="left" valign="middle">{$v['code'] }</td><td align="right" valign="middle"></td>
        			    			<td align="left" valign="top" colspan="2" class="cartmiddle">{$v['name']}</td>
        			    			<td align="left" valign="middle" align="right">{$_finish_item[$v['fitemid']]}</td> 
									<td align="right" valign="middle"></td>
									<td align="left" valign="middle">{$fabric_choice}</td>
        			    			<td align="right" valign="middle">{$v['price']}</td>
        			    			<td align="right" valign="middle">{$v['count']}</td>
        			    			<td align="right" valign="middle">{$v['cost']}</td>
        						</tr>

EOT;
} 

$total_cost  = number_format($total_cost, 2, '.', ',');
$content .= <<<EOT
        						<tr><td colspan="12" bgcolor="#A5AAB0" height=1></td></tr>
        						<tr>
        						  <td colspan=10 height=25 align="right"><strong>Total</strong> :</td>
        						  <td colspan=1 align="right">$total_qty2</td>
        						  <td colspan=1 align="right">$total_cost</td>
        						</tr>        						
        						
        						<tr><td colspan="12" height=5></td></tr>
        			    		<tr><td colspan="12" height=5></td></tr>
        						<tr><td colspan="12">Best regards<br><br>
                                Jans2en Furniture<br>
                                Hong Kong
                                </td></tr>
        			    		
        						</td></tr>
        						</table>						
                      
                              
                            
                            </td>
                          </tr>
                          <tr>
                            <td align="right" valign="bottom"><div class="paragraphSpacer"><img name="" src="{$web_url}images/spacer.gif" width="0" height="0" alt=""></div>
                              <div align="right"><img src="{$web_url}images/colour/jf_colour_gold_100.gif" alt="Gold Accent" name="jf_colour_gold_100" width="10" height="10" id="jf_colour_gold_100"></div></td>
                          </tr>
                        </table>
                        
                        
                        </td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="{$web_url}images/spacer.gif" width="10" height="10" alt=""></td>
                      <td width="1" align="left" valign="top" background="{$web_url}images/colour/jf_colour_navy_15.gif"><img name="" src="{$web_url}images/colour/jf_colour_navy_07.gif" width="1" height="1" alt=""></td>
                      <td width="4"><img name="" src="{$web_url}images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    <tr>
                      <td width="5"><img name="" src="{$web_url}images/spacer.gif" width="5" height="5" alt=""></td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="{$web_url}images/spacer.gif" width="10" height="10" alt=""></td>
                      <td bgcolor="FFFFFF" width="538"><img name="" src="{$web_url}images/spacer.gif" width="538" height="10" alt=""></td>
                      <td bgcolor="FFFFFF" width="10"><img name="" src="{$web_url}images/spacer.gif" width="10" height="10" alt=""></td>
                      <td width="1" align="left" valign="top" background="{$web_url}images/colour/jf_colour_navy_15.gif"><img name="" src="{$web_url}images/colour/jf_colour_navy_07.gif" width="1" height="1" alt=""></td>
                      <td width="4"><img name="" src="{$web_url}images/spacer.gif" width="4" height="4" alt=""></td>
                    </tr>
                    <tr>
                      <td width="5"><img name="" src="{$web_url}images/spacer.gif" width="5" height="1" alt=""></td>
                      <td width="10" align="left" valign="top" background="{$web_url}images/colour/jf_colour_navy_15.gif"><img name="" src="{$web_url}images/colour/jf_colour_navy_07.gif" width="1" height="1" alt=""></td>
                      <td background="{$web_url}images/colour/jf_colour_navy_15.gif" width="538"><img name="" src="{$web_url}images/spacer.gif" width="538" height="1" alt=""></td>
                      <td background="{$web_url}images/colour/jf_colour_navy_15.gif" width="10"><img name="" src="{$web_url}images/spacer.gif" width="10" height="1" alt=""></td>
                      <td width="1" align="left" valign="top" background="{$web_url}images/colour/jf_colour_navy_15.gif"><img name="" src="{$web_url}images/colour/jf_colour_navy_15.gif" width="1" height="1" alt=""></td>
                      <td width="4"><img name="" src="{$web_url}images/spacer.gif" width="4" height="1" alt=""></td>
                    </tr>
                  </table>
                  <div><img name="" src="{$web_url}images/spacer.gif" width="568" height="4" alt=""></div></td>
                <td background="{$web_url}images/colour/jf_colour_navy_100.gif" width="1"><img name="" src="{$web_url}images/spacer.gif" width="1" height="1" alt=""></td>
              </tr>              
            </table></td>
        </tr>
      </table>
      <div><img name="" src="{$web_url}images/spacer.gif" width="568" height="10" alt=""></div></td>
  </tr>
</table>
</body>
</html>
EOT;

?>